var express = require('express');
var router = express.Router();

const {
  findGoodsList,
  getAll,
  findById,
  findGoodsCategoryList,
  update,
  delById
} = require("../controller/goods");
const { authFilter } = require("../middlewares/auth");

class GoodsRouter {
  static initRouter() {
    router.get('/', findGoodsList);
    router.get('/getAll', authFilter, getAll);
    router.get('/category', findGoodsCategoryList);
    router.get('/:id', findById); //动态的丢在最后
    // router.post('/0', authFilter, insert);
    router.put('/:id', authFilter, update);
    router.delete('/:id', authFilter, delById);

    return router;
  }
}
module.exports = GoodsRouter.initRouter();